package com.cnzhy.web.config;

import com.cnzhy.web.servlet.MyServlet;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 嵌入式Servlet容器三大组件配置
 *
 * @author 赵 岩
 */
@Configuration
public class ServletConfig {

    /**
     * 注册Servlet组件
     * @param myServlet
     * @return
     */
    @Bean
    public ServletRegistrationBean getServlet(MyServlet myServlet) {
        return new ServletRegistrationBean(myServlet, "/hello");
    }
}
